import React from 'react'

export default function Count_hooks() {
  console.log('4');
  const [sum, setSum] = React.useState(0)
  function add() { 
    setSum(sum + 2)
  }
  React.useEffect(() => { 
    console.log('hello');
  }, [])
  return (
    <div>
      <h1>函数式组件</h1>
      <div>和：{ sum }</div>
      <button onClick={ add }>+</button>
    </div>
  )
}
